package com.jxw.launcher.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

/* loaded from: classes.dex */
public class SharedPreferencesUtil {
    public static final String BIRTHDAY_INFO = "birthday_info";
    public static final String DIQU_INFO = "diqu_info";
    private static final String FILE_NAME = "welcome_Page";
    public static final String FIRST_INTOAPP = "first_intoapp";
    public static final String FIRST_OPEN = "first_to";
    public static final String NAME_INFO = "name_info";
    public static final String NIANJI_INFO = "nianji_info";
    public static final String PHOTO_INFO = "photo_info";
    public static final String SEX_INFO = "sex_info";
    public static final String SHENGAO_INFO = "shengao_info";
    private static final String TAG = "SharedPreferencesUtil";
    public static final String TG_APP_INFO = "tg_app_info";
    public static final String TIZHONG_INFO = "tizhong_info";
    public static final String monoid = "monoid";
    public static final String phoneNumber = "phoneNumber";
    private static final String preferenceStr = "tm_book";
    private static SharedPreferences sharedPreferences;

    public static int getSelectSystem(Context context) {
        return context.getSharedPreferences("SELECT_SYSTEM_VALUE", 0).getInt("system_value", 0);
    }

    public static void setSelectSystem(Context context, int i) {
        SharedPreferences.Editor edit = context.getSharedPreferences("SELECT_SYSTEM_VALUE", 0).edit();
        edit.putInt("system_value", i);
        edit.commit();
    }

    public static Boolean getBoolean(Context context, String str, Boolean bool) {
        Boolean valueOf = Boolean.valueOf(context.getSharedPreferences(FILE_NAME, 0).getBoolean(str, bool.booleanValue()));
        Log.i(TAG, "getBoolean: " + valueOf);
        return valueOf;
    }

    public static void setBoolean(Context context, String str, Boolean bool) {
        SharedPreferences.Editor edit = context.getSharedPreferences(FILE_NAME, 0).edit();
        edit.putBoolean(str, bool.booleanValue());
        Log.i(TAG, "setBoolean: " + bool);
        edit.commit();
    }

    public static void putSpString(Context context, String str, String str2) {
        if (sharedPreferences == null) {
            sharedPreferences = context.getSharedPreferences(preferenceStr, 0);
        }
        sharedPreferences.edit().putString(str, str2).commit();
    }

    public static String getSpString(Context context, String str, String str2) {
        return context.getSharedPreferences(preferenceStr, 0).getString(str, str2);
    }

    public static String getString(Context context, String str, String str2) {
        if (sharedPreferences == null) {
            sharedPreferences = context.getSharedPreferences("monoid_sp", 0);
        }
        return sharedPreferences.getString(str, str2);
    }

    public static void setString(Context context, String str, String str2) {
        SharedPreferences.Editor edit = context.getSharedPreferences("monoid_sp", 0).edit();
        edit.putString(str, str2);
        edit.apply();
    }

    public static int getIntSystem(Context context) {
        return context.getSharedPreferences("SELECT_SYSTEM", 0).getInt("system_value", 0);
    }

    public static boolean setIntSystem(Context context, int i) {
        SharedPreferences.Editor edit = context.getSharedPreferences("SELECT_SYSTEM", 0).edit();
        try {
            edit.putInt("system_value", i);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return edit.commit();
    }

    public static String getStringUserInfo(Context context, String str) {
        return context.getSharedPreferences("USER_INFO", 0).getString(str, "");
    }

    public static boolean setStringUserInfo(Context context, String str, String str2) {
        SharedPreferences.Editor edit = context.getSharedPreferences("USER_INFO", 0).edit();
        try {
            edit.putString(str, str2);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return edit.commit();
    }

    public static Boolean getFirstIntoAppBoolean(Context context, Boolean bool) {
        return Boolean.valueOf(context.getSharedPreferences(FIRST_INTOAPP, 0).getBoolean("firstIntoApp", bool.booleanValue()));
    }

    public static void setFirstIntoAppBoolean(Context context, Boolean bool) {
        SharedPreferences.Editor edit = context.getSharedPreferences(FIRST_INTOAPP, 0).edit();
        edit.putBoolean("firstIntoApp", bool.booleanValue());
        edit.commit();
    }
}
